export default function ({ app, redirect, route, next }) {
    app.router.beforeEach((to, from, next) => {
        if (process.client) {
            const adminToken = localStorage.getItem("AdminToken");
            if (to.path.startsWith('/admin/') && to.path !== '/admin/login') {
                if (!adminToken) {
                    return next('/admin/login');
                }
            }
        }
        next();
    });
}